/**
 * 
 */
package org.tiger.springboot.redis.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tiger.common.domain.ResponseBean;
import org.tiger.springboot.redis.jedis.JedisClusterConfig;
import org.tiger.springboot.redis.service.IJedisOperateService;

/**
 * @author liuwenlai
 *
 */
@Component
public class JedisOperateServiceImpl implements IJedisOperateService {

	private static final Logger logger = LoggerFactory.getLogger(JedisOperateServiceImpl.class);

	@Autowired
	private JedisClusterConfig jedisClusterConfig;

	@Override
	public ResponseBean<Object> getObjByKey(String key) {
		Object value = jedisClusterConfig.getJedisClusterWithConfig().get(key);
		return new ResponseBean<Object>(value);
	}

	public void setObj(String key, Object value) {
		jedisClusterConfig.getJedisCluster().set(key, String.valueOf(value));
	}

}
